
#ifndef XDNS_INIT_H
#define XDNS_INIT_H

#include "xdns.h"
#include <string>
#include <vector>

/* This interface is implemented for Cross-Platform. It is implemented
   for the Unix-Like systems as default, reading the file
   /etc/resolv.conf, the code should be build successfully for
   Cross-Platform.
*/
class XdnsInit
{
public:
    static XdnsError Init(XdnsInit** init);
    static void Release(XdnsInit* init);

    /*! Retrieve the information of the system resolvers.

        This function calls the function GetDefaultResolvers as default.
        It should be redefined in the derived class for Cross-Platform.

        @param servers On return the system name servers.
        @return XE_Ok if success.
        @see GetDefaultResolvers.
    */
    virtual void GetSystemResolvers(std::vector<XdnsServerConfig>& servers) = 0;

protected:
    XdnsInit();
    virtual ~XdnsInit();

    /*! Retrieve the information of the default resolvers.

        If no resolver could be found, this function should be called in
        the function GetSystemResolvers of the derived class.

        @param servers On return the default name servers.
        @return None.
    */
    void GetDefaultResolvers(std::vector<XdnsServerConfig>& servers);
};

#endif  // XDNS_INIT_H

